<template>
  <div class="tag-main" @click="handler">
    <div class="tag-item" v-for="(item, index) in list" :key="index">
      {{ item }}
    </div>
  </div>
</template>

<script>
export default {
  name: "Tag",
  props: {
    list: Array,
  },
  methods: {
    handler(e) {
      let val = e.target.innerText;
      this.$bus.$emit('handler', val);
      this.$bus.$emit("setKeyword", val);
    },
  },
};
</script>

<style lang="scss" scoped>
.tag-main {
  display: flex;
  padding-left: 0.6667rem;
  flex-wrap: wrap;
  align-content: flex-start;
  margin-bottom: 0.5333rem;

  .tag-item {
    display: inline-block;
    border: 1px solid rgb(143, 143, 143);
    font-size: 0.32rem;
    padding: 0.1067rem;
    margin: 0.2667rem 0.2667rem 0 0.2667rem;
  }
}
</style>